﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using RemoteBank.Entity;

namespace RemoteBank.GUI
{
    public partial class frmAccount : Form
    {
        List<Account> listaccount;
        
        internal List<Account> Listaccount
        {
            get { return listaccount; }
            set { listaccount = value; }
        }
       
        public frmAccount(frmMain main)
        {
            InitializeComponent();
            this.listaccount = main.ListAccount;
            
        }

        private void frmAccount_Load(object sender, EventArgs e)
        {
            Display();
            
        }
        public void Display()
        {
            if (this.listaccount != null)
            {
             
                foreach (Account acc in listaccount)
                {
                    ListViewItem l = new ListViewItem(acc.AccountName);
                    l.SubItems.Add(acc.Balance.ToString());
                    
                    if (acc.AccountType == 1)
                    {
                        l.SubItems.Add("Receiving");
                    }else if(acc.AccountType==2)
                    {
                        l.SubItems.Add("Transfer");
                    }else if(acc.AccountType==3)
                    {
                        l.SubItems.Add("Withdrawls");
                    }
                    lvwAccountInformation.Items.Add(l);
                 
                }
              
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
